package com.wfcm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;



/**
 * 订单-商品关系表
 * 
 * @author xlf
 * @email xlfbe696@gmail.com
 * @date 2018-01-22 18:57:18
 */
public class WfGoodsOrderRelationEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	
	//
	private Integer id;
	//商品编号
	private Integer goodsid;
	//订单编号（时分秒+4位随机）
	private String ordercode;
	//购买的商品数量
	private Integer goodscount;
	//是否秒杀(0.否 1.是)
	private Integer saleflag;
	//商品支付时单价
	private BigDecimal goodsprice;
	//商品分类（1.课程 2.章节3.vip卡4商品）
	private Integer goodssort;
	//商品规格（goodsSort=4时）
	private String specification;
	//是否评价（1是2否）
	private Integer isevaluate;
	//是否退货(0.否 1.是)
	private Integer backflag;
	//
	private BigDecimal coppercash;
	//使用优惠券抵扣钱数
	private BigDecimal couponscash;
	//满减活动抵扣现金
	private BigDecimal activitycash;
	//原铜钱
	private BigDecimal oldcoppercash;
	//新铜钱
	private BigDecimal newcoppercash;
	//金币
	private BigDecimal gold;
	//金币
	private BigDecimal newGold;
	//实际支付
	private BigDecimal realpay;
	//版本号
	private String version;
	//用户编号
	private Integer userid;
	//添加时间
	private Date createtime;
	//订单状态
	private Integer orderstatus;
	
	private WfCourseInfoEntity courseInfoEntity;
	
	private WfCourseChapterEntity  courseChapterEntity;
	
	private WfVipCardEntity  vipCardEntity;

	private Integer access;

	public WfGoodsOrderRelationEntity() {
		super();
	}

	public void setPart(String ordercode, Integer goodscount, Integer saleflag, Integer isevaluate, Integer backflag, BigDecimal coppercash, String version, Integer userid, Date createtime, Integer orderstatus) {
		this.ordercode = ordercode;
		this.goodscount = goodscount;
		this.saleflag = saleflag;
		this.isevaluate = isevaluate;
		this.backflag = backflag;
		this.coppercash = coppercash;
		this.version = version;
		this.userid = userid;
		this.createtime = createtime;
		this.orderstatus = orderstatus;
	}

	public void setAllCash (Integer goodsid, BigDecimal goodsprice, Integer goodssort, BigDecimal activitycash, BigDecimal oldcoppercash, BigDecimal newcoppercash, BigDecimal gold, BigDecimal newGold) {
		this.goodsid = goodsid;
		this.goodsprice = goodsprice;
		this.goodssort = goodssort;
		this.activitycash = activitycash;
		this.oldcoppercash = oldcoppercash;
		this.newcoppercash = newcoppercash;
		this.gold = gold;
		this.newGold = newGold;
	}

	public WfGoodsOrderRelationEntity(Integer userid, Integer goodsid, Integer goodssort) {
		this.userid = userid;
		this.goodsid = goodsid;
		this.goodssort = goodssort;
	}

	public Integer getUserid() {
		return userid;
	}
	public void setUserid(Integer userid) {
		this.userid = userid;
	}
	public Date getCreatetime() {
		return createtime;
	}
	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}
	public Integer getOrderstatus() {
		return orderstatus;
	}
	public void setOrderstatus(Integer orderstatus) {
		this.orderstatus = orderstatus;
	}
	public WfCourseInfoEntity getCourseInfoEntity() {
		return courseInfoEntity;
	}
	public void setCourseInfoEntity(WfCourseInfoEntity courseInfoEntity) {
		this.courseInfoEntity = courseInfoEntity;
	}
	public WfCourseChapterEntity getCourseChapterEntity() {
		return courseChapterEntity;
	}
	public void setCourseChapterEntity(WfCourseChapterEntity courseChapterEntity) {
		this.courseChapterEntity = courseChapterEntity;
	}
	public WfVipCardEntity getVipCardEntity() {
		return vipCardEntity;
	}
	public void setVipCardEntity(WfVipCardEntity vipCardEntity) {
		this.vipCardEntity = vipCardEntity;
	}
	/**
	 * 设置：
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	/**
	 * 获取：
	 */
	public Integer getId() {
		return id;
	}
	/**
	 * 设置：商品编号
	 */
	public void setGoodsid(Integer goodsid) {
		this.goodsid = goodsid;
	}
	/**
	 * 获取：商品编号
	 */
	public Integer getGoodsid() {
		return goodsid;
	}
	/**
	 * 设置：订单编号（时分秒+4位随机）
	 */
	public void setOrdercode(String ordercode) {
		this.ordercode = ordercode;
	}
	/**
	 * 获取：订单编号（时分秒+4位随机）
	 */
	public String getOrdercode() {
		return ordercode;
	}
	/**
	 * 设置：购买的商品数量
	 */
	public void setGoodscount(Integer goodscount) {
		this.goodscount = goodscount;
	}
	/**
	 * 获取：购买的商品数量
	 */
	public Integer getGoodscount() {
		return goodscount;
	}
	/**
	 * 设置：是否秒杀(0.否 1.是)
	 */
	public void setSaleflag(Integer saleflag) {
		this.saleflag = saleflag;
	}
	/**
	 * 获取：是否秒杀(0.否 1.是)
	 */
	public Integer getSaleflag() {
		return saleflag;
	}
	/**
	 * 设置：商品支付时单价
	 */
	public void setGoodsprice(BigDecimal goodsprice) {
		this.goodsprice = goodsprice;
	}
	/**
	 * 获取：商品支付时单价
	 */
	public BigDecimal getGoodsprice() {
		return goodsprice;
	}
	/**
	 * 设置：商品分类（1.课程 2.章节3.vip卡4商品）
	 */
	public void setGoodssort(Integer goodssort) {
		this.goodssort = goodssort;
	}
	/**
	 * 获取：商品分类（1.课程 2.章节3.vip卡4商品）
	 */
	public Integer getGoodssort() {
		return goodssort;
	}
	/**
	 * 设置：商品规格（goodsSort=4时）
	 */
	public void setSpecification(String specification) {
		this.specification = specification;
	}
	/**
	 * 获取：商品规格（goodsSort=4时）
	 */
	public String getSpecification() {
		return specification;
	}
	/**
	 * 设置：是否评价（1是2否）
	 */
	public void setIsevaluate(Integer isevaluate) {
		this.isevaluate = isevaluate;
	}
	/**
	 * 获取：是否评价（1是2否）
	 */
	public Integer getIsevaluate() {
		return isevaluate;
	}
	/**
	 * 设置：是否退货(0.否 1.是)
	 */
	public void setBackflag(Integer backflag) {
		this.backflag = backflag;
	}
	/**
	 * 获取：是否退货(0.否 1.是)
	 */
	public Integer getBackflag() {
		return backflag;
	}
	/**
	 * 设置：
	 */
	public void setCoppercash(BigDecimal coppercash) {
		this.coppercash = coppercash;
	}
	/**
	 * 获取：
	 */
	public BigDecimal getCoppercash() {
		return coppercash;
	}
	/**
	 * 设置：使用优惠券抵扣钱数
	 */
	public void setCouponscash(BigDecimal couponscash) {
		this.couponscash = couponscash;
	}
	/**
	 * 获取：使用优惠券抵扣钱数
	 */
	public BigDecimal getCouponscash() {
		return couponscash;
	}
	/**
	 * 设置：满减活动抵扣现金
	 */
	public void setActivitycash(BigDecimal activitycash) {
		this.activitycash = activitycash;
	}
	/**
	 * 获取：满减活动抵扣现金
	 */
	public BigDecimal getActivitycash() {
		return activitycash;
	}
	/**
	 * 设置：原铜钱
	 */
	public void setOldcoppercash(BigDecimal oldcoppercash) {
		this.oldcoppercash = oldcoppercash;
	}
	/**
	 * 获取：原铜钱
	 */
	public BigDecimal getOldcoppercash() {
		return oldcoppercash;
	}
	/**
	 * 设置：新铜钱
	 */
	public void setNewcoppercash(BigDecimal newcoppercash) {
		this.newcoppercash = newcoppercash;
	}
	/**
	 * 获取：新铜钱
	 */
	public BigDecimal getNewcoppercash() {
		return newcoppercash;
	}
	/**
	 * 设置：金币
	 */
	public void setGold(BigDecimal gold) {
		this.gold = gold;
	}
	/**
	 * 获取：金币
	 */
	public BigDecimal getGold() {
		return gold;
	}

	public BigDecimal getNewGold() {
		return newGold;
	}

	public void setNewGold(BigDecimal newGold) {
		this.newGold = newGold;
	}

	/**
	 * 设置：实际支付
	 */
	public void setRealpay(BigDecimal realpay) {
		this.realpay = realpay;
	}
	/**
	 * 获取：实际支付
	 */
	public BigDecimal getRealpay() {
		return realpay;
	}
	/**
	 * 设置：版本号
	 */
	public void setVersion(String version) {
		this.version = version;
	}
	/**
	 * 获取：版本号
	 */
	public String getVersion() {
		return version;
	}

	public Integer getAccess() {
		return access;
	}

	public void setAccess(Integer access) {
		this.access = access;
	}

	public static WfGoodsOrderRelationEntity generateFreeEntity(Integer userid, String orderCode, Integer goodsId, Integer goodsSort) {
		WfGoodsOrderRelationEntity entity = new WfGoodsOrderRelationEntity();
		BigDecimal zero = new BigDecimal("0");
		entity.setGoodsid(goodsId);
		entity.setGoodsprice(zero);
		entity.setGoodssort(goodsSort);//前面已经保存
		entity.setNewcoppercash(zero);//新铜钱消耗
		entity.setGold(zero);//金币消耗
		entity.setRealpay(zero);//微信消费
		entity.setCouponscash(zero);
		entity.setActivitycash(zero);
		entity.setOldcoppercash(zero);
		entity.setOrdercode(orderCode);
		entity.setGoodscount(1);
		entity.setSaleflag(0);
		entity.setIsevaluate(2);//是否评价（1是2否）
		entity.setBackflag(0);//是否退货(0.否 1.是)
		entity.setCoppercash(zero);
		entity.setVersion("3.0");//版本号3.0
		entity.setUserid(userid);
		entity.setCreatetime(new Date());
		entity.setOrderstatus(4);
		return entity;
	}
}
